package Tests;
import static org.junit.Assert.*;

import org.junit.Test;

import MailSystem.Message;
import MailSystem.MessageQueue;


public class MessageQueueTest {

	@Test
	public void testRemove() {
		MessageQueue queue = new MessageQueue();
		
		queue.add(new Message("1"));
		queue.add(new Message("2"));
		queue.add(new Message("3"));
		queue.add(new Message("4"));
		Message msg = queue.remove();
		assertEquals("1", msg.getText());
	}

	@Test
	public void testAdd() {
		MessageQueue queue = new MessageQueue();
		
		queue.add(new Message("1"));
		queue.add(new Message("2"));
		queue.add(new Message("3"));
		queue.add(new Message("4"));
		Message msg = queue.remove();
		assertEquals("1", msg.getText());
	}

	@Test
	public void testSize() {
		MessageQueue queue = new MessageQueue();
		
		queue.add(new Message("1"));
		queue.add(new Message("2"));
		queue.add(new Message("3"));
		queue.add(new Message("4"));
		
		assertEquals(4, queue.size());
	}

	@Test
	public void testPeek() {
		MessageQueue queue = new MessageQueue();
		
		queue.add(new Message("1"));
		queue.add(new Message("2"));
		queue.add(new Message("3"));
		queue.add(new Message("4"));
		Message msg = queue.peek();
		assertEquals("1", msg.getText());
	}

}
